package com.example.cloud.webflux.reactor;

import com.example.cloud.webflux.model.PersonInfo;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * TODO 类实现描述
 *
 * @author tongyufu
 * @since 2019年6月11日 下午11:52:11
 */
@Component
public class PersonHandler {

    public Mono<ServerResponse> listPeople(ServerRequest request) {
        Flux<PersonInfo> persons = Flux.just(new PersonInfo(1, "用户2"), new PersonInfo(2, "用户2"));
        return ServerResponse.ok().body(persons, PersonInfo.class);
    }

    public Mono<ServerResponse> createPerson(ServerRequest request) {
        return Mono.empty();
    }

    public Mono<ServerResponse> getPerson(ServerRequest request) {
        return Mono.empty();
    }
}
